package com.mcptt.config.body.pidf;

import android.util.Xml;

import com.cloudptt.api.product.func.crsc.FuncNumOb;
import com.cloudptt.api.product.log.Log;

import org.xmlpull.v1.XmlPullParser;

import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.UUID;
import java.util.Vector;

public class PidfXmlBodyLogoutAll {


	private String uuid = null;
	private String mcpttId = "";
	private String[] funcNumList =null;
	private String user =null;
	private String pidfId = "pidfa01";

	private List<FuncNumOb> funcNameList = null;


	public PidfXmlBodyLogoutAll(String mcpttId, String[] funcNumList)
	{
		this.uuid = UUID.randomUUID().toString();;
		this.mcpttId = mcpttId;
		this.funcNumList = funcNumList;
	}



	public String toValueString()
	{
		StringBuffer strBuf = new StringBuffer();
		strBuf.append("uuid = ").append(uuid).append(",");
		strBuf.append("mcpttId = ").append(mcpttId).append(",");
		strBuf.append("funcNumList = ").append(funcNumList).append(",");
		strBuf.append("pidfId = ").append(pidfId).append(",");
//		strBuf.append("isActive = ").append(isActive).append(",");
//		strBuf.append("type = ").append(type).append(",");
		strBuf.append("funcNameList = ").append(funcNameList).append(".");

		return strBuf.toString();
	}
	public String toString()
	{

		StringBuffer strBuff = new StringBuffer();
		strBuff.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("\r\n");
		strBuff.append("<presence entity=\"").append(mcpttId).append("\">").append("\r\n");
		strBuff.append("<tuple id=\"").append(uuid).append("\">").append("\r\n");
		strBuff.append("<status>").append("\r\n");
		for(int i = 0; i< funcNumList.length;i++)
		{
			String funcNum = funcNumList[i];
			strBuff.append("<mcpttPIFA10:functionalAlias functionalAliasID=\"").append(funcNum).append("\"/>").append("\r\n");
		}
		strBuff.append("</status>").append("\r\n");
		strBuff.append("</tuple>").append("\r\n");
		strBuff.append("<mcpttPIFA10:p-id-fa>").append(pidfId).append("</mcpttPIFA10:p-id-fa>").append("\r\n");
		strBuff.append("</presence>").append("\r\n");
		
		try {
			return new String(strBuff.toString().getBytes(),"UTF-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return strBuff.toString();
	}

	public String getUuid() {
		return uuid;
	}
	public String getUser() {
		return user;
	}
	public List<FuncNumOb> getFuncNameList() {
		return funcNameList;
	}
//	public int getType() {
//		return type;
//	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
